<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
      <el-form-item label="店铺名称" prop="title">
        <el-input
          v-model="queryParams.title"
          placeholder="请输入公司名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>


      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['app:appcostcompany:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['app:appcostcompany:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['app:appcostcompany:remove']"
        >删除</el-button>
      </el-col>
   <!--   <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['app:appcostcompany:export']"
        >导出</el-button>
      </el-col>-->
    </el-row>

    <el-table v-loading="loading" :data="appcostcompanyList" stripe @selection-change="handleSelectionChange" >
      <el-table-column type="selection" width="55" align="center" />
     <!-- <el-table-column label="编号" align="center" prop="id" />
      <el-table-column label="收费项目编号" align="center" prop="cid" />
      <el-table-column label="收费项目名称" align="center" prop="cname" />
      <el-table-column label="收费单价" align="center" prop="cmoney" />
      <el-table-column label="收费单位" align="center" prop="cunit" />
      <el-table-column label="最小单位" align="center" prop="cmin" />
      <el-table-column label="最大单位" align="center" prop="cmax" />
      <el-table-column label="收费项目ID" align="center" prop="projectId" />
      <el-table-column label="收费项目" align="center" prop="projectName" />-->
      <el-table-column label="店铺名称" align="center" prop="title" />
      <el-table-column label="门头照" align="center" prop="companyPic" width="200px">
        <template slot-scope="scope">
          <el-image
            style="width: 200px; height: 100px"
            :src="scope.row.companyPic"
            fit="fill"></el-image>
        </template>
      </el-table-column>
      <el-table-column label="公司类型" align="center" prop="costCompnayType" />
<!--      <el-table-column label="纬度" align="center" prop="lat" />
      <el-table-column label="经度" align="center" prop="lng" />-->
<!--      <el-table-column label="营业执照" align="center" prop="licensePic" />
      <el-table-column label="公司法人" align="center" prop="name" />
      <el-table-column label="联系方式" align="center" prop="mobile" />
      <el-table-column label="公司地址" align="center" prop="address" />
      <el-table-column label="经营范围" align="center" prop="businessScope" />
      <el-table-column label="执照编号" align="center" prop="businessCode" />-->
      <el-table-column label="缴费类型" align="center" prop="costType" />
      <el-table-column label="收费标准" align="center" prop="costStandard" />
      <el-table-column label="应收金额" align="center" prop="totalMoney" />
      <el-table-column label="目前已缴费金额" align="center" prop="money" />
   <!--   <el-table-column label="清运单位" align="center" prop="clearUnit" />
      <el-table-column label="垃圾生产量" align="center" prop="clearNum" />
      <el-table-column label="联系人姓名" align="center" prop="clearName" />
      <el-table-column label="联系人姓名" align="center" prop="clearMobile" />
      <el-table-column label="清运公司名称" align="center" prop="clearCompanyName" />
      <el-table-column label="是否隐藏 " align="center" prop="hide" />
      <el-table-column label="状态" align="center" prop="state" />
      <el-table-column label="归属部门" align="center" prop="deptName" />-->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['app:appcostcompany:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['app:appcostcompany:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改店铺管理对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-tabs type="border-card">
          <el-tab-pane label="基础信息">
            <el-form-item label="店铺名称" prop="title">
              <el-input v-model="form.title" placeholder="请输入公司名称" />
            </el-form-item>
            <el-form-item label="门头照" prop="companyPic">
              <!--<el-input v-model="form.companyPic" placeholder="请输入门头照" />-->
              <el-upload
                class="avatar-uploader"
                action="https://jsonplaceholder.typicode.com/posts/"
                :show-file-list="false"
                :on-success="(response, file, fileList) => handleSuccess(response, file, fileList, '1')"
                :http-request="uploadCompnayPic">
                <img v-if="form.companyPic" :src="'../prod-api/app/files/' + form.companyPic" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
            </el-form-item>
            <el-form-item label="选择位置" prop="lat">
              <div class="amap-wrapper">
                <div class="amap-page-container">
                  <el-amap-search-box class="search-box" :search-option="searchOption" :on-search-result="onSearchResult"></el-amap-search-box>
                  <el-amap vid="amapDemo" :center="mapCenter" :zoom="zoom" :events="events" class="amap-demo">
                    <el-amap-marker v-for="marker in markers" :position="marker" :key="marker.index" ></el-amap-marker>
                  </el-amap>
                </div>
              </div>
            </el-form-item>

            <el-form-item label="" >
              <el-input  placeholder="请输入纬度" :value="'当前经纬度:' + currLatLng"/>
            </el-form-item>

            <!--<el-form-item label="是否隐藏 " prop="hide">
              <el-input v-model="form.hide" placeholder="请输入是否隐藏 " />
            </el-form-item>-->
          </el-tab-pane>

          <el-tab-pane label="营业执照">
            <el-form-item label="营业执照" prop="licensePic">
              <!--<el-input v-model="form.licensePic" placeholder="请输入营业执照" />-->
              <el-upload
                class="avatar-uploader"
                action="https://jsonplaceholder.typicode.com/posts/"
                :show-file-list="false"
                :on-success="(response, file, fileList) => handleSuccess(response, file, fileList, '2')"
                :http-request="uploadLicense">
                <img v-if="form.licensePic" :src="'../prod-api/app/files/' + form.licensePic" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <el-dialog :visible.sync="form.licensePic == ''">
                <img width="100%" :src="form.licensePic" alt="">
              </el-dialog>
            </el-form-item>
            <el-form-item label="公司名称" prop="companyName">
              <el-input v-model="form.companyName" placeholder="请输入公司名称" />
            </el-form-item>
            <el-form-item label="公司法人" prop="name">
              <el-input v-model="form.name" placeholder="请输入公司法人" />
            </el-form-item>
            <el-form-item label="联系方式" prop="mobile">
              <el-input v-model="form.mobile" placeholder="请输入联系方式" />
            </el-form-item>
            <el-form-item label="公司地址" prop="address">
              <el-input v-model="form.address" placeholder="请输入公司地址" />
            </el-form-item>
            <el-form-item label="经营范围" prop="businessScope">
              <el-input
                type="textarea"
                :autosize="{ minRows: 4, maxRows: 4}"
                placeholder="请输入经营范围"
                v-model="form.businessScope">
              </el-input>
            </el-form-item>
            <el-form-item label="执照编号" prop="businessCode">
              <el-input v-model="form.businessCode" placeholder="请输入执照编号" />
            </el-form-item>
          </el-tab-pane>

          <el-tab-pane label="缴费信息">
            <el-form-item label="是否免征">
              <el-radio-group v-model="form.costType">
                <el-radio key="0" label="0">否</el-radio>
                <el-radio key="1" label="1">是</el-radio>
              </el-radio-group>

            </el-form-item>
            <el-form-item label="公司类型" v-if="form.costType == '0'">
              <el-radio-group v-model="form.costCompnayType" @change="changeHandlerType">
                <el-radio
                  v-for="item in allprojectList"
                  :key="item.id"
                  :label="item.id"
                >{{item.name}}</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="收费分类" v-if="form.costType == '0'">
              <el-select v-model="form.projectId" placeholder="请选择收费分类" @change="changeHandlerProject">
                <el-option
                  v-for="project in costProjectList"
                  :key="project.id"
                  :label="project.name"
                  :value="project.id"
                />
              </el-select>
              <div v-for="project in categoryRateList">区间(元):{{project.minNum}}-{{project.maxNum}}  &nbsp;&nbsp;单价:{{project.money}}元/{{project.unit}}</div>
            </el-form-item>
            <el-form-item label="收费标准" prop="costStandard" v-if="form.costType == '0'">
              <el-input v-model="form.costStandard" placeholder="请输入收费标准" />
            </el-form-item>
            <el-form-item label="应收金额" prop="totalMoney" v-if="form.costType == '0'">
              <el-input v-model="form.totalMoney" placeholder="请输入应收金额" />
            </el-form-item>
            <el-form-item label="目前已缴费金额" prop="money" v-if="form.costType == '0'">
              <el-input v-model="form.money" placeholder="请输入目前已缴费金额" />
            </el-form-item>
          </el-tab-pane>

          <el-tab-pane label="清运信息">
            <el-form-item label="清运单位" prop="clearUnit">
              <el-radio-group v-model="form.clearUnit">
                <el-radio
                  v-for="dict in clearUnitOptions"
                  :key="dict.dictValue"
                  :label="dict.dictValue"
                >{{dict.dictLabel}}</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="垃圾生产量" prop="clearNum">
              <el-input v-model="form.clearNum" placeholder="请输入垃圾生产量" />
            </el-form-item>
            <el-form-item label="联系人姓名" prop="clearName">
              <el-input v-model="form.clearName" placeholder="请输入联系人姓名" />
            </el-form-item>
            <el-form-item label="联系人方式" prop="clearMobile">
              <el-input v-model="form.clearMobile" placeholder="请输入联系人姓名" />
            </el-form-item>
            <el-form-item label="清运公司名称" prop="clearCompanyName">
              <el-input v-model="form.clearCompanyName" placeholder="请输入清运公司名称" />
            </el-form-item>
          </el-tab-pane>
        </el-tabs>
        <!--<el-form-item label="收费项目编号" prop="cid">
          <el-input v-model="form.cid" placeholder="请输入收费项目编号" />
        </el-form-item>
        <el-form-item label="收费项目名称" prop="cname">
          <el-input v-model="form.cname" placeholder="请输入收费项目名称" />
        </el-form-item>
        <el-form-item label="收费单价" prop="cmoney">
          <el-input v-model="form.cmoney" placeholder="请输入收费单价" />
        </el-form-item>
        <el-form-item label="收费单位" prop="cunit">
          <el-input v-model="form.cunit" placeholder="请输入收费单位" />
        </el-form-item>
        <el-form-item label="最小单位" prop="cmin">
          <el-input v-model="form.cmin" placeholder="请输入最小单位" />
        </el-form-item>
        <el-form-item label="最大单位" prop="cmax">
          <el-input v-model="form.cmax" placeholder="请输入最大单位" />
        </el-form-item>
        <el-form-item label="收费项目ID" prop="projectId">
          <el-input v-model="form.projectId" placeholder="请输入收费项目ID" />
        </el-form-item>
        <el-form-item label="收费项目" prop="projectName">
          <el-input v-model="form.projectName" placeholder="请输入收费项目" />
        </el-form-item>-->

        <!--<el-form-item label="删除标记" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入删除标记" />
        </el-form-item>
        <el-form-item label="状态" prop="state">
          <el-input v-model="form.state" placeholder="请输入状态" />
        </el-form-item>
        <el-form-item label="归属部门编号" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入归属部门编号" />
        </el-form-item>
        <el-form-item label="归属部门" prop="deptName">
          <el-input v-model="form.deptName" placeholder="请输入归属部门" />
        </el-form-item>-->




      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listAppcostcompany, getAppcostcompany, delAppcostcompany, addAppcostcompany, updateAppcostcompany , uploadCompnayPic,uploadLicense , queryCostProjectList} from "@/api/app/appcostcompany";

export default {
  name: "Appcostcompany",
  data() {
    let self = this;
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 店铺管理表格数据
      appcostcompanyList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        cid: undefined,
        cname: undefined,
        cmoney: undefined,
        cunit: undefined,
        cmin: undefined,
        cmax: undefined,
        projectId: undefined,
        projectName: undefined,
        title: undefined,
        companyPic: undefined,
        lat: undefined,
        lng: undefined,
        licensePic: undefined,
        name: undefined,
        mobile: undefined,
        address: undefined,
        businessScope: undefined,
        businessCode: undefined,
        costType: undefined,
        costCompnayType: undefined,
        costStandard: undefined,
        totalMoney: undefined,
        money: undefined,
        clearUnit: undefined,
        clearNum: undefined,
        clearName: undefined,
        clearMobile: undefined,
        clearCompanyName: undefined,
        hide: undefined,
        state: undefined,
        deptId: undefined,
        deptName: undefined,
      },
      // 表单参数
      form: {},
      clearUnitOptions:[],
      allprojectList:[],
      costProjectList:[],
      categoryRateList:[],
      // 表单校验
      rules: {
        title: [
          { required: true, message: "公司名称不能为空", trigger: "blur" }
        ],
        companyPic: [
          { required: true, message: "门头照不能为空", trigger: "blur" }
        ],
        createTime: [
          { required: true, message: "创建时间不能为空", trigger: "blur" }
        ]
      },
      currLatLng: '',
      // 高德地图
      events: {
        init(o) {
          console.log("初始化高德地图1")
        },
        click(e) {

          self.form.lng = e.lnglat.lng;
          self.form.lat = e.lnglat.lat;
          self.currLatLng = e.lnglat.lng + ","+e.lnglat.lat;
          console.log(self.currLatLng);
          self.addMarker(e.lnglat.lng, e.lnglat.lat);
          // addMarker: function() {
          //   let lng = 121.5 + Math.round(Math.random() * 1000) / 10000;
          //   let lat = 31.197646 + Math.round(Math.random() * 500) / 10000;
          //   this.markers.push([lng, lat]);

        }
      },
      markers: [

      ],
      searchOption: {
        city: '邯郸',
        citylimit: true
      },
      zoom: 13,
      mapCenter: [114.494707,36.61089],

    };
  },
  created() {
    this.getList();
    this.queryCostProjectList();
    this.getDicts("app_clear_unit").then(response => {
      this.clearUnitOptions = response.data;
    });
  },
  methods: {
    /** 查询店铺管理列表 */
    getList() {
      this.loading = true;
      listAppcostcompany(this.queryParams).then(response => {
        this.appcostcompanyList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    queryCostProjectList() {
      this.loading = true;
      queryCostProjectList().then(response => {
        this.allprojectList = response.data;
        console.log(this.allprojectList);
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        cid: undefined,
        cname: undefined,
        cmoney: undefined,
        cunit: undefined,
        cmin: undefined,
        cmax: undefined,
        projectId: undefined,
        projectName: undefined,
        title: undefined,
        companyPic: undefined,
        lat: '',
        lng: '',
        licensePic: undefined,
        compnayName: '',
        name: undefined,
        mobile: undefined,
        address: undefined,
        businessScope: undefined,
        businessCode: undefined,
        costType: undefined,
        costCompnayType: undefined,
        costStandard: undefined,
        totalMoney: undefined,
        money: undefined,
        clearUnit: undefined,
        clearNum: undefined,
        clearName: undefined,
        clearMobile: undefined,
        clearCompanyName: undefined,
        hide: undefined,
        delFlag: undefined,
        remark: undefined,
        state: undefined,
        deptId: undefined,
        deptName: undefined,
        createBy: undefined,
        createTime: undefined
      };
      this.currLatLng = "";
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加店铺管理";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getAppcostcompany(id).then(response => {
        var that = this;
        that.form = response.data;
        console.log(JSON.stringify(response.data));
        if(that.form.lat && that.form.lng){
          that.currLatLng = that.form.lat + "," + that.form.lng;

          setTimeout(function () {
            console.log(that.currLatLng);
            console.log("********************");
            that.addMarker(that.form.lng, that.form.lat);
          }, 300);

        }
        this.allprojectList.forEach(function (item, index, array) {
          if(that.form.costCompnayType){
           console.log( item.id + "=" + that.form.costCompnayType);
            if(item.id == that.form.costCompnayType){
              that.costProjectList = item.children;
            }
          }
        });
        that.costProjectList.forEach(function (item, index, array) {
          if(item.id == that.form.projectId){
            console.info(JSON.stringify(item)); //当前元素的值
            that.categoryRateList = item.children;
            console.log(that.categoryRateList);
            console.log("------------changeHandlerProject--------------");
          }
        });
        this.open = true;
        this.title = "修改店铺管理";
      });
    },
    /** 提交按钮 */
    submitForm: function() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != undefined) {
            updateAppcostcompany(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              }
            });
          } else {
            addAppcostcompany(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              }
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除店铺管理编号为"' + ids + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delAppcostcompany(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(function() {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('app/appcostcompany/export', {
        ...this.queryParams
      }, `app_appcostcompany.xlsx`)
    },
    // 高德地图搜索功能
    addMarker: function(lng, lat) {
      this.markers = [];
      this.markers.push([lng, lat]);
      console.log("addMarker");
    },
    onSearchResult(pois) {
      this.markers = [];
      if (pois.length > 0) {
        let {lng, lat} = pois[0];
        this.markers.push([lng, lat]);
        this.mapCenter = [lng, lat];
        // pois.forEach(poi => {
        //   let {lng, lat} = poi;
        // });


      }
    },
    uploadCompnayPic(param) {
      var fileObj = param.file;
      // FormData 对象
      var formData = new FormData();
      // 文件对象
      formData.append("picfile", fileObj);
      uploadCompnayPic(formData)
        .then(response => {
          if (response.code === 200) {
            //this.msgSuccess("附件上传成功");
            //this.form.testifyFile = response.url;
            //上传成功 调用onSuccess方法，否则没有完成图标
            //处理自己的逻辑
            param.onSuccess(response);
            fileObj.url = response.url;
          } else {
            this.msgError(response.msg);
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    uploadLicense(param) {
      var fileObj = param.file;
      // FormData 对象
      var formData = new FormData();
      // 文件对象
      formData.append("picfile", fileObj);
      uploadLicense(formData)
        .then(response => {
          if (response.code === 200) {
            //this.msgSuccess("附件上传成功");
            //this.form.testifyFile = response.url;
            //上传成功 调用onSuccess方法，否则没有完成图标
            //处理自己的逻辑
            param.onSuccess(response);
            fileObj.url = response.url;
          } else {
            this.msgError(response.msg);
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    handlePreview(file) {
      this.form.uploadCompnayPic = file.url;
      console.log("---------------handlePreview--------------");
    },
    handleRemove(file, fileList) {
      console.log("---------------handleRemove--------------");
      // var that = this;
      // that.form.testifyFile = JSON.stringify(fileList);
      // console.log(that.form.testifyFile);
    },
    handleSuccess(response, file, fileList, type) {
      console.log(response);

      if(response.code && response.code == 200){
        if(type == "1"){
          this.form.companyPic = response.data;
        }else if(type == "2"){
          this.form.licensePic = response.data;
        }

      }
    },
    handlePictureCardPreview(file) {
      this.form.licensePic = file.url;
    },
    changeHandlerType(value) {
      console.log('改变之后的值是:' + value)
      var that = this;
      this.allprojectList.forEach(function (item, index, array) {
        if(item.id == value){
          console.info(JSON.stringify(item)); //当前元素的值
          that.costProjectList = item.children;
          console.log(that.costProjectList);
          console.log("-------------changeHandlerType-------------");
        }
      });
    },
    changeHandlerProject(value) {
      console.log('改变之后的值是:' + value)
      var that = this;
      this.costProjectList.forEach(function (item, index, array) {
        if(item.id == value){
          console.info(JSON.stringify(item)); //当前元素的值
          that.categoryRateList = item.children;
          console.log(that.categoryRateList);
          console.log("------------changeHandlerProject--------------");
        }
      });
    }


  },
  watch: {
    'form.costStandard':{
      handler(newValue,oldValue){
        var that = this;
        console.log(newValue + "=" + oldValue)
        var bool = false;
        this.categoryRateList.forEach(function (item, index, array) {
          if(item.minNum <= newValue && item.maxNum >= newValue || item.maxNum == 999999){
            console.info(item.money * newValue); //当前元素的值
            console.log("------------watch--------------");
            that.form.totalMoney = item.money * newValue;
            bool = true;
          }
        });

        console.log("--------------");
      }
    }
  }
};
</script>

<style >
  .amap-wrapper {
    width: 100%;
  }
  .amap-demo {
    margin-top: -40px;
  }

  .search-box {
    position: absolute;
    top: 25px;
    left: 20px;
  }

  .amap-page-container {
    position: relative;
    width: 100%;
    height: 400px;
  }

  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 140px;
    height: 140px;
    line-height: 140px;
    text-align: center;
  }
  .avatar {
    width: 140px;
    height: 140px;
    display: block;
  }
</style>
